import 'package:finance_app/src/entities/depreciation_entity.dart';

depreciationEntityFromJson(DepreciationEntity data, Map<String, dynamic> json) {
	if (json['data_type'] != null) {
		data.dataType = json['data_type'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['key'] != null) {
		data.key = json['key'].toString();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['description'] != null) {
		data.description = json['description'].toString();
	}
	return data;
}

Map<String, dynamic> depreciationEntityToJson(DepreciationEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['data_type'] = entity.dataType;
	data['id'] = entity.id;
	data['key'] = entity.key;
	data['name'] = entity.name;
	data['description'] = entity.description;
	return data;
}